package com.workerhelping.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.workerhelping.dao.AdminRecordVODao;
import com.workerhelping.elasticsearchEntity.ESRecordVO;
import com.workerhelping.service.AdminRecordVOService;
import com.workerhelping.vo.AdminRecordVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AdminRecordVOServiceImpl extends ServiceImpl<AdminRecordVODao, AdminRecordVO> implements AdminRecordVOService {

    @Override
    public IPage<AdminRecordVO> getAllByUnreviewed(Integer pageNo,Integer pageSize) {
        Page<AdminRecordVO> page = new Page<>(pageNo,pageSize);
        IPage<AdminRecordVO> records = baseMapper.getAllByUnreviewed(page);
        return records;
    }

    @Override
    public IPage<AdminRecordVO> getAllByApproved(Integer pageNo, Integer pageSize) {
        Page<AdminRecordVO> page = new Page<>(pageNo,pageSize);
        IPage<AdminRecordVO> records = baseMapper.getAllByApproved(page);
        return records;
    }

    @Override
    public IPage<AdminRecordVO> getAllByRejected(Integer pageNo, Integer pageSize) {
        Page<AdminRecordVO> page = new Page<>(pageNo,pageSize);
        IPage<AdminRecordVO> records = baseMapper.getAllByRejected(page);
        return records;
    }

    @Override
    public IPage<AdminRecordVO> getAllByCancelled(Integer pageNo, Integer pageSize) {
        Page<AdminRecordVO> page = new Page<>(pageNo,pageSize);
        IPage<AdminRecordVO> records = baseMapper.getAllByCancelled(page);
        return records;
    }

}
